<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<script type="text/javascript" src="<c:url value="/js/jquery.timeTo.js"/>"></script>
<link rel="stylesheet" type="text/css" href="<c:url value="/css/timeTo.css"/>">
<script type="text/javascript">
	$(function() {
		$('#logo').click(showAdminForm);
		$('#btn_adminLogin').click(doAdminLogin);
		
		$('#globalTimer').timeTo();
	});
	
	function showAdminForm(){
		$('.adminOnly').fadeIn(1000);
	}
	
	/* Nav-bar Menus for Admin */  
	function goAdminMenu(action){
		if(action == 'resultPrint') { if(!confirm("파일로 저장하시겠습니까?")) { return; } }
		$("#commonForm input:hidden").attr('value', action);
		$('#commonForm').attr('action', 'admin.do');
		$('#commonForm').submit();
	}
	
	/* Nav-bar Menus for Common */
	function doLogout(){
		if(confirm("로그아웃 하시겠습니까?")){
			$("#commonForm input:hidden").attr('value', 'logout');
			$('#commonForm').attr('action', 'admin.do');
			$('#commonForm').submit();			
		}
	}
	
	function doAdminLogin(){
		$("#commonForm input:hidden").attr('value', 'login');
		$('#commonForm').attr('action', 'admin.do');
		$('#commonForm').submit();
	}
</script>

<form method="post" id="commonForm">
<input type="hidden" name="action" id="action">

	<div class="common_top">
		<h3 class="text-muted" id="logo">
			Algorithm Festival Season II
			<c:if test="${errorMsg != null}">${errorMsg}</c:if>
		</h3>
		<ul class="nav nav-justified">
			<li><a href="javascript:goAdminMenu('main')">메인</a></li>
			<li><a href="javascript:goAdminMenu('missionList')">미션 관리</a></li>
			<li><a href="#">팀 관리(UC)</a></li>
			<li><a href="javascript:goAdminMenu('resultList')">점수 총계</a></li>
			<li><a href="#">데이터 리셋</a></li>
			<li><a href="javascript:doLogout();">로그아웃</a></li>
		</ul>
	</div>	

</form>
</html>